<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>如何在mpvue中使用第三方UI组件 | Storm</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="最近接触了小程序业务，了解到美团的 mpvue 也可以做小程序。 使用方式也很简单，和 vue 一样， 但是他会自动将 Vue 编译为 小程序 语言。 下面言归正传，介绍一下如何在 mpvue 中使用第三方组件。  创建 mpvue  1vue init mpvue/mpvue-quickstart my-app    以 ivew weapp UI 举例 ，进入其 github 地址，下载后将">
<meta name="keywords" content="小程序">
<meta property="og:type" content="article">
<meta property="og:title" content="如何在mpvue中使用第三方UI组件">
<meta property="og:url" content="https://storm4542.github.io/archives/599cc31e.html">
<meta property="og:site_name" content="Storm">
<meta property="og:description" content="最近接触了小程序业务，了解到美团的 mpvue 也可以做小程序。 使用方式也很简单，和 vue 一样， 但是他会自动将 Vue 编译为 小程序 语言。 下面言归正传，介绍一下如何在 mpvue 中使用第三方组件。  创建 mpvue  1vue init mpvue/mpvue-quickstart my-app    以 ivew weapp UI 举例 ，进入其 github 地址，下载后将">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2018-08-27T06:10:18.626Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="如何在mpvue中使用第三方UI组件">
<meta name="twitter:description" content="最近接触了小程序业务，了解到美团的 mpvue 也可以做小程序。 使用方式也很简单，和 vue 一样， 但是他会自动将 Vue 编译为 小程序 语言。 下面言归正传，介绍一下如何在 mpvue 中使用第三方组件。  创建 mpvue  1vue init mpvue/mpvue-quickstart my-app    以 ivew weapp UI 举例 ，进入其 github 地址，下载后将">
  
    <link rel="alternative" href="https://storm4542.github.io/atom.xml" title="Storm" type="application/atom+xml">
  
  
    <link rel="icon" href="https://storm4542.github.io/favicon.png">
  
  <link href="static/css/css.css" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="static/css/style.css">
  

</head></html>
<body>
  <div id="container">
    <div id="wrap">
      <div class="outer">
        <section id="main"><article id="post-如何在mpvue中使用第三方UI组件" class="article article-type-post" itemscope="" itemprop="blogPost">
  
  <div class="article-inner">
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      如何在mpvue中使用第三方UI组件
    </h1>
  

      </header>
    
    <div class="article-meta">
      <a href="" class="article-date">
  <time datetime="2018-08-27T06:02:43.000Z" itemprop="datePublished">2018-08-27</time>
</a>
      
    </div>
    <div class="article-entry" itemprop="articleBody">
      
        <p>最近接触了小程序业务，了解到美团的 mpvue 也可以做小程序。</p>
<p>使用方式也很简单，和 vue 一样， 但是他会自动将 Vue 编译为 小程序 语言。</p>
<p>下面言归正传，介绍一下如何在 mpvue 中使用第三方组件。</p>
<ol>
<li><p>创建 mpvue </p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vue init mpvue/mpvue-quickstart my-app</span><br></pre></td></tr></table></figure>
</li>
</ol>
<ol start="2">
<li>以 ivew weapp UI 举例 ，进入其 github 地址，下载后将 dist 目录下的所有东西，拷贝到 my-app 下 static 的 ivew (自己创建) 目录。</li>
</ol>
<ol start="3">
<li><p>在需要使用的页面中创建 main.json。</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="attr">"usingComponents"</span>: &#123;</span><br><span class="line">    <span class="attr">"i-card"</span>: <span class="string">"../../../static/iview/card/index"</span>,</span><br><span class="line">    <span class="attr">"i-button"</span>: <span class="string">"../../../static/iview/button/index"</span></span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<ol start="4">
<li><p>接下来就可以在 index.vue 中使用该标签了。</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">template</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span>&gt;</span></span><br><span class="line">   <span class="tag">&lt;<span class="name">i-card</span> <span class="attr">full</span> <span class="attr">title</span>=<span class="string">"卡片标题"</span> <span class="attr">extra</span>=<span class="string">"额外内容"</span> <span class="attr">thumb</span>=<span class="string">"https://i.loli.net/2017/08/21/599a521472424.jpg"</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">view</span> <span class="attr">slot</span>=<span class="string">"content"</span>&gt;</span>内容不错<span class="tag">&lt;/<span class="name">view</span>&gt;</span></span><br><span class="line">      <span class="tag">&lt;<span class="name">view</span> <span class="attr">slot</span>=<span class="string">"footer"</span>&gt;</span>尾部内容<span class="tag">&lt;/<span class="name">view</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">i-card</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">i-button</span> <span class="attr">type</span>=<span class="string">"success"</span>&gt;</span>按钮<span class="tag">&lt;/<span class="name">i-button</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br></pre></td></tr></table></figure>
</li>
</ol>

      

      
        
    </div>
  </div>
  
    
<nav id="article-nav">
  
    <a href="9fa8d30b.html" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          关于JavaScript日期的一些小技巧
        
      </div>
    </a>
  
  
    <a href="18e53f06.html" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">在 Vue Cli 3 中使用 px2rem</div>
    </a>
  
</nav>

  
</article>


<section id="comments">
  <link rel="stylesheet" href="static/css/default.css">
  <script src="static/js/gitment.browser.js"></script>
  <script>
    var gitment = new Gitment({
      owner: 'your github account',
      repo: 'your repo',
      oauth: {
        client_id: 'your client_id',
        client_secret: 'your client_secret',
      },
    })
    gitment.render('comments')
  </script>
</section>

</section>
        <aside id="sidebar">
  <nav class="menus">
  	<ul>
  		<li><a href="index.html"><i class="icon icon-home"></i></a></li>
  		
			<li><a href="index1.html"><i class="icon icon-fenlei"></i></a></li>
  		
  		
			<li><a href="index2.html"><i class="icon icon-tag"></i></a></li>
  		
  		
  			<li><a href="javascript:;" target="_blank" rel="external nofollow noopener noreferrer"><i class="icon icon-github"></i></a></li>
  		
  	</ul>
  </nav>
  <a id="go-top" href="#"><i class="icon icon-up"></i></a>
</aside>

      </div>
      <footer id="footer">
  
	<div id="footer-info" class="inner">
	  &copy; 2019 Storm 
	  - Powered by <a href="javascript:;" target="_blank" rel="external nofollow noopener noreferrer">Hexo</a>
	  - Theme <a href="javascript:;" target="_blank" rel="external nofollow noopener noreferrer">Jane</a>
	</div>
</footer>

    </div>
    <nav id="mobile-nav">
  
    <a href="index.html" class="mobile-nav-link">Home</a>
  
    <a href="index1.html" class="mobile-nav-link">Archives</a>
  
    <a href="index2.html" class="mobile-nav-link">Tag</a>
  
    <a href="javascript:;" class="mobile-nav-link" rel="external nofollow noopener noreferrer" target="_blank">Github</a>
  
</nav>
    
<script>
  var disqus_shortname = 'storm';
  
  var disqus_url = 'https://storm4542.github.io/archives/599cc31e.html';
  
  (function(){
    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
</script>


<script src="static/js/jquery.min.js"></script>


  <link rel="stylesheet" href="static/css/jquery.fancybox.css">
  <script src="static/js/jquery.fancybox.pack.js"></script>


<script src="static/js/script.js"></script>

  </div>
</body>
